package com.crm.customers.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.crm.base.dao.BaseDao;
import com.crm.customers.dao.ApproveItemDao;
import com.crm.customers.model.ApproveItem;
import com.crm.customers.model.ContractMoneylog;

@Repository("approveItemDao")
public class ApproveItemDaoImpl extends BaseDao implements ApproveItemDao {
	
	private static final String MAPPER_NAMESPACE = "ApproveItemMapper.";

	@Override
	public int deleteByPrimaryKey(Long id) {
		return delete(MAPPER_NAMESPACE+"deleteByPrimaryKey", id);
	}

	@Override
	public ApproveItem insertSelective(ApproveItem record) {
		 insert(MAPPER_NAMESPACE+"insertSelective", record);
		 return record;
	}

	@Override
	public ApproveItem selectByPrimaryKey(Long id) {
		ApproveItem ai = new ApproveItem();
		ai.setId(id);
		return selectOne(MAPPER_NAMESPACE+"selectByPrimaryKey", ai);
	}

	@Override
	public int updateByPrimaryKeySelective(ApproveItem record) {
		return update(MAPPER_NAMESPACE+"updateByPrimaryKeySelective", record);
	}

	@Override
	public List<ApproveItem> selectApproveListByParam(ApproveItem record) {
		List<ApproveItem> list = selectList(MAPPER_NAMESPACE+"selectApproveListByParam", record);
		if (list!=null && list.size() > 0) {
			list.get(0).setTotalResults((Integer)selectOne(MAPPER_NAMESPACE+"selectApproveListByParamCount", record));
		}
		return list;
	}

	@Override
	public List<ApproveItem> selectMyListByParam(ApproveItem record) {
		List<ApproveItem> list = selectList(MAPPER_NAMESPACE+"selectByPrimaryKey", record);
		if (list!=null && list.size() > 0) {
			list.get(0).setTotalResults((Integer)selectOne(MAPPER_NAMESPACE+"selectByPrimaryKeyCount", record));
		}
		return list;
	}
 

}
